﻿using System;
using System.Data;
using System.Data.SqlClient;
using System.Data.SqlTypes;
using Microsoft.SqlServer.Server;

public partial class UserDefinedFunctions
{
    [SqlFunction]
    public static SqlDateTime ConvertToDate(SqlDateTime DateTimeValue)
    {
        if (DateTimeValue.IsNull) 
            return SqlDateTime.Null;
        return DateTimeValue.Value.Date;
    }
};

